<!DOCTYPE html>
<html>

<head>
    <style>
        /* 使用flex布局*/
        ul {
            border: 1px solid rgb(216, 216, 216);
            width: 80%;
            margin: auto;
            padding: 0;
            display: flex;
        }

        li {
            margin: 0;
            list-style: none;
            line-height: 3em;
            border-bottom: 1px solid transparent;
            padding: 0 1em;
        }

        li:hover {
            border-bottom: 1px solid rgb(8, 250, 0);
            cursor: pointer;
        }

        li a {
            text-decoration: none;
            color: black;
        }

        li:last-child {
            margin-left: auto;
        }

        @media screen and (max-width:500px) {
            /* 自适应导航栏 */
            ul {
                flex-flow: column;
                
            }

            li:last-child {
                margin-left: 0;
            }
        }
    </style>
</head>

<body>
    <nav>
        <ul>
            <li><a href="#">HOME</a></li>
            <li><a href="#">BLOG</a></li>
            <li><a href="#">ARTICLE</a></li>
            <li><a href="#">CONTACT</a></li>
        </ul>

    </nav>
</body>

</html>